package cn.duhengkui.national.poi.utils;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.duhengkui.national.valuelist.annotation.QueryObjCol;



public class ExcelUtil {
	
	public static <T> Map<String,List<String>> getExcelHeader(Class<T> clazz){
		 List<String> cellNames = new ArrayList<String>();
		 List<String> fieldNames = new ArrayList<String>();
		 for(Field field : clazz.getDeclaredFields()){
			 if(field.isAnnotationPresent(QueryObjCol.class)){
				 QueryObjCol cellAnnotion = field.getAnnotation(QueryObjCol.class);
				 cellNames.add(cellAnnotion.name());
				 fieldNames.add(field.getName());
			 }
		 }
		 Map<String,List<String>> map = new HashMap<String,List<String>>();
		 map.put("cell", cellNames);
		 map.put("field", fieldNames);
		 return map;
	}

}
